public class Stringcount {
    public static void main(String[] args) {
        String str ="hell sdf sdfj fsd";
        int count = 0;
        for (int i = 0; i <str.length(); i++) {
            if(str.charAt(i)==' '){
                count++;
            }
        }
        count++;
        System.out.println(count);
    }
}
